<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增报告基本信息')" />
    <style type="text/css">
        .assessmentRationality-title{
            text-align: center;
            padding: 20px;
        }

    </style>
</head>
<body>
    <form class="layui-form">
        <div class="mainBox">
            <div class="main-container">
            <div class="layui-form-item">
                <label class="layui-form-label">报告标题：</label>
                <div class="layui-input-block">
                    <input type="text" name="title" placeholder="请输入报告标题" class="layui-input" />
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">学年学期：</label>
                <div class="layui-input-block">
                    <input type="text" name="academic" placeholder="请输入学年学期" class="layui-input" />
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">课程类型及学分：</label>
                <div class="layui-input-block">
                    <input type="text" name="typeAndScore" placeholder="请输入课程类型及学分" class="layui-input" />
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">专业班级及人数：</label>
                <div class="layui-input-block">
                    <input type="text" name="classStudentNum" placeholder="请输入专业班级及人数" class="layui-input" />
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">任课教师：</label>
                <div class="layui-input-block">
                    <input type="text" name="teacher" placeholder="请输入任课教师" class="layui-input" />
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">考核方式：</label>
                <div class="layui-input-block">
                    <input type="text" name="assessmentMethod" placeholder="请输入考核方式" class="layui-input" />
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">评价依据：</label>
                <div class="layui-input-block">
                    <input type="text" name="evaluationBasis" placeholder="请输入评价依据" class="layui-input" />
                </div>
            </div>

            </div>

            <!--        课程目标-->
            <div class="layui-card">
                <div class="layui-card-header">
                    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;font-weight: bold">
                        <legend>课程目标</legend>
                    </fieldset>
                </div>
                <div class="layui-card-body">
                    <table id="courseTarget" lay-filter="courseTarget"></table>
                </div>
            </div>

<!--            课程目标与毕业要求观测点的对应关系-->
            <div class="layui-card">
                <div class="layui-card-header">
                    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;font-weight: bold">
                        <legend>课程目标与毕业要求观测点的对应关系</legend>
                    </fieldset>
                </div>
                <div class="layui-card-body">
                    <table id="courseTargetobservationContact" lay-filter="courseTargetobservationContact"></table>
                </div>
            </div>

            <!--            评价内容与学生能力相关性-->
            <div class="layui-card" id="evaluateAbilityRelevanceCard">
                <div class="layui-card-header">
                    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;font-weight: bold">
                        <legend>评价内容与学生能力相关性</legend>
                    </fieldset>
                </div>
                <div class="layui-card-body">
                    <table id="evaluateAbilityRelevance" lay-filter="evaluateAbilityRelevance"></table>
                </div>
            </div>

            <!--            考核合理性审核-->
            <div class="layui-card" id="assessmentRationalityCard">
                <div class="layui-card-header">
                    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;font-weight: bold">
                        <legend>考核合理性审核</legend>
                    </fieldset>
                </div>
                <div class="layui-card-body">
                    <h4 class="assessmentRationality-title">毕业要求、毕业要求指标点与课程目标</h4>
                    <div class="layui-form-item">
                        <label class="layui-form-label">学期：</label>
                        <div class="layui-input-block">
                            <input type="text" name="semester" placeholder="请输入" class="layui-input" />
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">课程：</label>
                        <div class="layui-input-block">
                            <input type="text" name="course" placeholder="请输入" class="layui-input" />
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">出卷老师：</label>
                        <div class="layui-input-block">
                            <input type="text" name="teacherpaper" placeholder="请输入" class="layui-input" />
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">审核老师：</label>
                        <div class="layui-input-block">
                            <input type="text" name="teachercheck" placeholder="请输入" class="layui-input" />
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">适合班级：</label>
                        <div class="layui-input-block">
                            <input type="text" name="grade" placeholder="请输入" class="layui-input" />
                        </div>
                    </div>
                    <table id="assessmentRationalityTable1" lay-filter="assessmentRationalityTable1"></table>
                    <h4 class="assessmentRationality-title">课程目标、试卷对应试题与分值</h4>
                    <table id="assessmentRationalityTable2" lay-filter="assessmentRationalityTable2"></table>
                    <h4 class="assessmentRationality-title">试卷内容支撑、课程目标的说明</h4>
                    <table id="assessmentRationalityTable3" lay-filter="assessmentRationalityTable3"></table>
                    <div class="layui-form-item">
                        <label class="layui-form-label">课程组审核意见：</label>
                        <div class="layui-input-block">
                            <input type="text" name="courseGroupAuditOpinion" placeholder="请输入课程组审核意见" class="layui-input" />
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">专业审核意见：</label>
                        <div class="layui-input-block">
                            <input type="text" name="majorAuditOpinion" placeholder="专业审核意见" class="layui-input" />
                        </div>
                    </div>
                </div>
            </div>

            <!--            平时成绩评分标准-->
            <div class="layui-card" id="usualScoreStandardCard">
                <div class="layui-card-header">
                    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;font-weight: bold">
                        <legend>平时成绩评分标准</legend>
                    </fieldset>
                </div>
                <div class="layui-card-body">
                    <table id="usualScoreStandard" lay-filter="usualScoreStandard"></table>
                </div>
            </div>

            <!--            评价结果-->
            <div class="layui-card" id="evaluationResultsCard">
                <div class="layui-card-header">
                    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;font-weight: bold">
                        <legend>评价结果</legend>
                    </fieldset>
                </div>
                <div class="layui-card-body">
                    <table id="evaluationResults" lay-filter="evaluationResults"></table>
                </div>
            </div>

            <!--            任课教师分析与改进-->
            <div class="layui-card" id="teacherAnalysisImprovementCard">
                <div class="layui-card-header">
                    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;font-weight: bold">
                        <legend>任课教师分析与改进</legend>
                    </fieldset>
                </div>
                <div class="layui-card-body">
                    <div class="layui-form-item">
                        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
                            <legend>上传图片</legend>
                        </fieldset>

                        <div class="layui-upload">
                            <button type="button" class="layui-btn" id="teacherAnalysisImprovementUpload">上传图片</button>
                            <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;">
                                预览图：
                                <div class="layui-upload-list" id="teacherAnalysisImprovementUploadUrl"></div>
                            </blockquote>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">文字说明：</label>
                        <div class="layui-input-block">
                            <input type="text" name="explain" placeholder="文字说明" class="layui-input" />
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">原因分析：</label>
                        <div class="layui-input-block">
                            <input type="text" name="cause" placeholder="原因分析" class="layui-input" />
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">拟采取的改进措施：</label>
                        <div class="layui-input-block">
                            <input type="text" name="measures" placeholder="拟采取的改进措施" class="layui-input" />
                        </div>
                    </div>
                </div>
            </div>

            <!--            学生调查问卷-->
            <div class="layui-card" id="studentQuestionnaireCard">
                <div class="layui-card-header">
                    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;font-weight: bold">
                        <legend>学生调查问卷</legend>
                    </fieldset>
                </div>
                <div class="layui-card-body">
                    <div class="layui-form-item">
                        <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
                            <legend>上传图片</legend>
                        </fieldset>

                        <div class="layui-upload">
                            <button type="button" class="layui-btn" id="studentQuestionnaireUpload">上传图片</button>
                            <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;">
                                预览图：
                                <div class="layui-upload-list" id="studentQuestionnaireUploadUrl"></div>
                            </blockquote>
                        </div>
                    </div>
                </div>
            </div>

            <!--            课程组负责人审核意见-->
            <div class="layui-card" id="auditOpinionCard">
                <div class="layui-card-header">
                    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;font-weight: bold">
                        <legend>课程组负责人审核意见</legend>
                    </fieldset>
                </div>
                <div class="layui-card-body">
                    <div class="layui-form-item">
                        <label class="layui-form-label">审核意见：</label>
                        <div class="layui-input-block">
                            <input type="text" name="auditOpinion" placeholder="审核意见" class="layui-input" />
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">审核时间：</label>
                        <div class="layui-input-block">
                            <input type="text" name="audittime" placeholder="审核时间" class="layui-input" id="audittime" />
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class="bottom">
            <div class="button-container">
                <button type="submit" class="pear-btn pear-btn-primary pear-btn-sm" lay-submit="" lay-filter="baseinfo-save">
                    <i class="layui-icon layui-icon-ok"></i>
                    提交
                </button>
                <button type="reset" class="pear-btn pear-btn-sm">
                    <i class="layui-icon layui-icon-refresh"></i>
                    重置
                </button>
            </div>
        </div>
    </form>

</body>
<th:block th:include="include :: footer" />
<script type="text/html" id="courseTargetRowToolbar">
    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>

<script type="text/html" id="evaluateAbilityRelevanceRowToolbar">
    <a class="layui-btn layui-btn-xs" lay-event="add">新增</a>
    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>

<script th:inline="javascript">

    // 学生调查问卷图片数组
    var studentQuestionnaire = []

    var teacherAnalysisImprovementImgUrl = []

Array.prototype.insert = function(index) {
    index = Math.min(index, this.length);
    arguments.length > 1
    && this.splice.apply(this, [index, 0].concat([].pop.call(arguments)))
    && this.insert.apply(this, arguments);
    return this;
};

    // 课程目标表格组件
    layui.use('table',function () {
        var table = layui.table;

        //课程目标表格
        table.render({
            elem: '#courseTarget'
            ,id:'courseTargetId'
            ,toolbar:true
            ,defaultToolbar:[{
                title:'新增'
                ,layEvent:'addRow'
                ,icon:'layui-icon-addition'
            }]
            ,height: 312
            ,data:[]
            ,cols: [[ //表头
                {field: 'id', title: 'ID', hide:true }
                ,{field: 'title', title: '标题',edit:'text'}
                ,{field: 'content', title: '内容',edit:'text'}
                ,{field: 'reportId', title: '报告基本信息id', hide:true}
                ,{fixed: 'right', align:'center', toolbar: '#courseTargetRowToolbar'}
            ]]
        });

        table.on('toolbar(courseTarget)',function (obj) {
            var courseTargetCheckStatus = table.checkStatus(obj.config.id)
            var checkStatus = table.checkStatus(obj.config.id)
            switch (obj.event) {
                case 'addRow':
                    buttonArr = [];//清空数组
                    var courseTargetData = table.cache.courseTargetId;
                    console.log('courseTargetData is',courseTargetData)
                    for (var i = 0; i < courseTargetData.length; i++) {
                        buttonArr.push(courseTargetData[i]);      //将之前的数组存储
                    }
                    //在尾部新增一行空数据，实现增行效果
                    buttonArr.push({
                        "id": null,
                        "title": '',
                        "content": '',
                        "reportId":null
                    });
                    table.reload("courseTargetId", {
                        data: buttonArr   // 将新数据重新载入表格
                    })
                    layer.msg('添加成功')
                    break;
            }
        })

        table.on('tool(courseTarget)',function (obj) {
            var data = obj.data; //获得当前行数据
            console.log('data is',data)
            var layEvent = obj.event; //获得 lay-event 对应的值（也可以是表头的 event 参数对应的值）
            var tr = obj.tr; //获得当前行 tr 的 DOM 对象（如果有的话）

            if(layEvent === 'detail'){ //查看
                //do somehing
            } else if(layEvent === 'del'){ //删除
                layer.confirm('真的删除行么', function(index){
                    obj.del(); //删除对应行（tr）的DOM结构，并更新缓存
                    layer.close(index);
                    //向服务端发送删除指令
                });
            } else if(layEvent === 'edit'){ //编辑
                //do something
                //同步更新缓存对应的值
                obj.update({
                    data
                });
                layer.msg('保存成功')
            } else if(layEvent === 'LAYTABLE_TIPS'){
                layer.alert('Hi，头部工具栏扩展的右侧图标。');
            }
        })

        table.on('edit(courseTarget)', function(obj){ //注：edit是固定事件名，test是table原始容器的属性 lay-filter="对应的值"
            console.log(obj.value); //得到修改后的值
            console.log(obj.field); //当前编辑的字段名
            console.log(obj.data); //所在行的所有相关数据
            var data = obj.data
            obj.update({
                data
            })
        });


        // 课程目标与毕业要求观测点的对应关系表格
        table.render({
            elem: '#courseTargetobservationContact'
            ,id:'courseTargetobservationContactId'
            ,toolbar:true
            ,defaultToolbar:[{
                title:'新增'
                ,layEvent:'addRow'
                ,icon:'layui-icon-addition'
            }]
            ,height: 312
            ,data:[]
            ,cols: [[ //表头
                {field: 'id', title: 'ID', hide:true }
                ,{field: 'courseObjectives', title: '课程目标',edit:'text'}
                ,{field: 'observation', title: '毕业要求观测点',edit:'text'}
                ,{field: 'reportId', title: '报告基本信息id', hide:true}
                ,{fixed: 'right', align:'center', toolbar: '#courseTargetRowToolbar'}
            ]]
        });

        table.on('toolbar(courseTargetobservationContact)',function (obj) {
            var courseTargetCheckStatus = table.checkStatus(obj.config.id)
            var checkStatus = table.checkStatus(obj.config.id)
            switch (obj.event) {
                case 'addRow':
                    buttonArr = [];//清空数组
                    var courseTargetobservationContactData = table.cache.courseTargetobservationContactId;
                    console.log('courseTargetobservationContactData is',courseTargetobservationContactData)
                    for (var i = 0; i < courseTargetobservationContactData.length; i++) {
                        buttonArr.push(courseTargetobservationContactData[i]);      //将之前的数组存储
                    }
                    //在尾部新增一行空数据，实现增行效果
                    buttonArr.push({
                        "id": null,
                        "courseObjectives": '',
                        "observation": '',
                        "reportId":null
                    });
                    table.reload("courseTargetobservationContactId", {
                        data: buttonArr   // 将新数据重新载入表格
                    })
                    layer.msg('添加成功')
                    break;
            }
        })

        table.on('tool(courseTargetobservationContact)',function (obj) {
            var data = obj.data; //获得当前行数据
            console.log('data is',data)
            var layEvent = obj.event; //获得 lay-event 对应的值（也可以是表头的 event 参数对应的值）
            var tr = obj.tr; //获得当前行 tr 的 DOM 对象（如果有的话）

            if(layEvent === 'detail'){ //查看
                //do somehing
            } else if(layEvent === 'del'){ //删除
                layer.confirm('真的删除行么', function(index){
                    obj.del(); //删除对应行（tr）的DOM结构，并更新缓存
                    layer.close(index);
                    //向服务端发送删除指令
                });
            } else if(layEvent === 'edit'){ //编辑
                //do something
                //同步更新缓存对应的值
                obj.update({
                    data
                });
                layer.msg('保存成功')
            } else if(layEvent === 'LAYTABLE_TIPS'){
                layer.alert('Hi，头部工具栏扩展的右侧图标。');
            }
        })

        table.on('edit(courseTargetobservationContact)', function(obj){ //注：edit是固定事件名，test是table原始容器的属性 lay-filter="对应的值"
            console.log(obj.value); //得到修改后的值
            console.log(obj.field); //当前编辑的字段名
            console.log(obj.data); //所在行的所有相关数据
            var data = obj.data
            obj.update({
                data
            })
        });

        // 评价内容与学生能力相关性表格
        table.render({
            elem: '#evaluateAbilityRelevance'
            ,id:'evaluateAbilityRelevanceId'
            ,toolbar:true
            ,defaultToolbar:[{
                title:'新增'
                ,layEvent:'addRow'
                ,icon:'layui-icon-addition'
            }]
            ,height: 312
            ,data:[]
            ,cols: [[ //表头
                {field: 'id', title: 'ID', hide:true }
                ,{field: 'groupId', title: '分组ID', hide:true }
                ,{field: 'courseObjectives', title: '课程目标',edit:'text'}
                ,{field: 'evaluationLink', title: '评价环节', edit:'text'}
                ,{field: 'evaluationContent', title: '评价内容', edit:'text'}
                ,{field: 'capabilityRelevance', title: '与学生能力相关性', edit:'text'}
                ,{field: 'reportId', title: '报告基本信息id', hide:true}
                ,{fixed: 'right', align:'center', toolbar: '#evaluateAbilityRelevanceRowToolbar'}
            ]]
            , done : function(res, curr, count) {
                //如果是异步请求数据方式，res即为你接口返回的信息。
                //如果是直接赋值的方式，res即为：{data: [], count: 99} data为当前页数据、count为数据总长度
                console.log(res);

                //得到当前页码
                console.log(curr);

                //得到数据总量
                console.log(count);

                // 合并单元格
                evaluateAbilityRelevanceCardMerge(res);
            }
        });

        table.on('toolbar(evaluateAbilityRelevance)',function (obj) {
            var courseTargetCheckStatus = table.checkStatus(obj.config.id)
            var checkStatus = table.checkStatus(obj.config.id)
            switch (obj.event) {
                case 'addRow':
                    buttonArr = [];//清空数组
                    var evaluateAbilityRelevanceData = table.cache.evaluateAbilityRelevanceId;
                    console.log('evaluateAbilityRelevanceData is',evaluateAbilityRelevanceData)
                    for (var i = 0; i < evaluateAbilityRelevanceData.length; i++) {
                        buttonArr.push(evaluateAbilityRelevanceData[i]);      //将之前的数组存储
                    }
                    var currentGroupId
                    if(evaluateAbilityRelevanceData.length > 0){
                        currentGroupId = evaluateAbilityRelevanceData[evaluateAbilityRelevanceData.length-1].groupId + 1
                    }else {
                        currentGroupId = 1
                    }
                    console.log('currentGroupId is',currentGroupId)
                    //在尾部新增一行空数据，实现增行效果,id设置为最近一条数据+1
                    buttonArr.push({
                        id:getRandom(),
                        groupId: currentGroupId,
                        courseObjectives:'数据' + currentGroupId,
                        evaluationLink:'',
                        evaluationContent:'',
                        capabilityRelevance:'',
                        reportId: null
                    });
                    table.reload("evaluateAbilityRelevanceId", {
                        data: buttonArr   // 将新数据重新载入表格
                    })
                    layer.msg('添加成功')
                    break;
            }
        })

        table.on('tool(evaluateAbilityRelevance)',function (obj) {
            var data = obj.data; //获得当前行数据
            console.log('data is',data)
            var layEvent = obj.event; //获得 lay-event 对应的值（也可以是表头的 event 参数对应的值）
            var tr = obj.tr; //获得当前行 tr 的 DOM 对象（如果有的话）

            if(layEvent === 'detail'){ //查看
                //do somehing
            } else if(layEvent === 'del'){ //删除
                layer.confirm('真的删除行么', function(index){
                    buttonArr = [];//清空数组
                    var evaluateAbilityRelevanceData = table.cache.evaluateAbilityRelevanceId;
                    for (var i = evaluateAbilityRelevanceData.length - 1; i >= 0 ; i--) {
                        if(evaluateAbilityRelevanceData[i].id === data.id){
                            evaluateAbilityRelevanceData.splice(i,1)
                            break
                        }
                    }
                    for (var i = 0; i < evaluateAbilityRelevanceData.length; i++) {
                        buttonArr.push(evaluateAbilityRelevanceData[i]);      //将之前的数组存储
                    }
                    table.reload("evaluateAbilityRelevanceId", {
                        data: buttonArr   // 将新数据重新载入表格
                    })
                    layer.close(index)
                });
            } else if(layEvent === 'edit'){ //编辑
                //do something
                //同步更新缓存对应的值
                obj.update({
                    data
                });
                layer.msg('保存成功')
            } else if(layEvent === 'LAYTABLE_TIPS'){
                layer.alert('Hi，头部工具栏扩展的右侧图标。');
            } else if(layEvent === 'add'){ // 新增
                buttonArr = [];//清空数组
                var evaluateAbilityRelevanceData = table.cache.evaluateAbilityRelevanceId;
                var index
                for (var i = evaluateAbilityRelevanceData.length - 1; i >= 0 ; i--) {
                    if(evaluateAbilityRelevanceData[i].id === data.id){
                        index = i
                        break
                    }
                }
                for (var i = 0; i < evaluateAbilityRelevanceData.length; i++) {
                    buttonArr.push(evaluateAbilityRelevanceData[i]);      //将之前的数组存储
                }
            console.log('evaluateAbilityRelevanceData is',evaluateAbilityRelevanceData)
            console.log('index is',index)
                //在该数据后部增加一条数据
                buttonArr.insert(index+1,{
                    id:getRandom(),
                    groupId:data.groupId,
                    courseObjectives:data.courseObjectives,
                    evaluationLink:'',
                    evaluationContent:'',
                    capabilityRelevance:'',
                    reportId: data.reportId
                });
                table.reload("evaluateAbilityRelevanceId", {
                    data: buttonArr   // 将新数据重新载入表格
                })
                layer.msg('添加成功')
            }
        })


        table.on('edit(evaluateAbilityRelevance)', function(obj){ //注：edit是固定事件名，test是table原始容器的属性 lay-filter="对应的值"
            console.log(obj.value); //得到修改后的值
            console.log(obj.field); //当前编辑的字段名
            console.log(obj.data); //所在行的所有相关数据
            var data = obj.data
            buttonArr = [];//清空数组
            var evaluateAbilityRelevanceData = table.cache.evaluateAbilityRelevanceId;
            for (var i = evaluateAbilityRelevanceData.length - 1; i >= 0 ; i--) {
                if(evaluateAbilityRelevanceData[i].groupId === data.groupId){
                    evaluateAbilityRelevanceData[i].courseObjectives = data.courseObjectives
                }
            }
            for (var i = 0; i < evaluateAbilityRelevanceData.length; i++) {
                buttonArr.push(evaluateAbilityRelevanceData[i]);      //将之前的数组存储
            }
            table.reload("evaluateAbilityRelevanceId", {
                data: buttonArr   // 将新数据重新载入表格
            })
        });

        // 考核合理性审核表格1
        table.render({
            elem: '#assessmentRationalityTable1'
            ,id:'assessmentRationalityTable1Id'
            ,toolbar:true
            ,defaultToolbar:[{
                title:'新增'
                ,layEvent:'addRow'
                ,icon:'layui-icon-addition'
            }]
            ,height: 312
            ,data:[]
            ,cols: [[ //表头
                {field: 'graduationRequirements', title: '毕业要求',edit:'text'}
                ,{field: 'indexPoint', title: '毕业要求指标点', edit:'text'}
                ,{field: 'courseObjectives', title: '课程目标', edit:'text'}
                ,{fixed: 'right', align:'center', toolbar: '#courseTargetRowToolbar'}
            ]]
        });

        table.on('toolbar(assessmentRationalityTable1)',function (obj) {
            var checkStatus = table.checkStatus(obj.config.id)
            switch (obj.event) {
                case 'addRow':
                    buttonArr = [];//清空数组
                    var assessmentRationalityTable1Data = table.cache.assessmentRationalityTable1Id;
                    console.log('assessmentRationalityTable1Data is',assessmentRationalityTable1Data)
                    for (var i = 0; i < assessmentRationalityTable1Data.length; i++) {
                        buttonArr.push(assessmentRationalityTable1Data[i]);      //将之前的数组存储
                    }
                    //在尾部新增一行空数据，实现增行效果
                    buttonArr.push({
                        "graduationRequirements": '',
                        "indexPoint": '',
                        "courseObjectives":''
                    });
                    table.reload("assessmentRationalityTable1Id", {
                        data: buttonArr   // 将新数据重新载入表格
                    })
                    layer.msg('添加成功')
                    break;
            }
        })

        table.on('tool(assessmentRationalityTable1)',function (obj) {
            var data = obj.data; //获得当前行数据
            console.log('data is',data)
            var layEvent = obj.event; //获得 lay-event 对应的值（也可以是表头的 event 参数对应的值）
            var tr = obj.tr; //获得当前行 tr 的 DOM 对象（如果有的话）

            if(layEvent === 'detail'){ //查看
                //do somehing
            } else if(layEvent === 'del'){ //删除
                layer.confirm('真的删除行么', function(index){
                    obj.del(); //删除对应行（tr）的DOM结构，并更新缓存
                    layer.close(index);
                    //向服务端发送删除指令
                });
            } else if(layEvent === 'edit'){ //编辑
                //do something
                //同步更新缓存对应的值
                obj.update({
                    data
                });
                layer.msg('保存成功')
            } else if(layEvent === 'LAYTABLE_TIPS'){
                layer.alert('Hi，头部工具栏扩展的右侧图标。');
            }
        })

        table.on('edit(assessmentRationalityTable1)', function(obj){ //注：edit是固定事件名，test是table原始容器的属性 lay-filter="对应的值"
            console.log(obj.value); //得到修改后的值
            console.log(obj.field); //当前编辑的字段名
            console.log(obj.data); //所在行的所有相关数据
            var data = obj.data
            obj.update({
                data
            })
        });

        // 考核合理性审核表格1
        table.render({
            elem: '#assessmentRationalityTable2'
            ,id:'assessmentRationalityTable2Id'
            ,toolbar:true
            ,defaultToolbar:[{
                title:'新增'
                ,layEvent:'addRow'
                ,icon:'layui-icon-addition'
            }]
            ,height: 312
            ,data:[]
            ,cols: [[ //表头
                {field: 'courseObjectives', title: '课程目标',edit:'text'}
                ,{field: 'testQuestions', title: '试卷对应试题', edit:'text'}
                ,{field: 'score', title: '分值', edit:'text'}
                ,{fixed: 'right', align:'center', toolbar: '#courseTargetRowToolbar'}
            ]]
        });

        table.on('toolbar(assessmentRationalityTable2)',function (obj) {
            var checkStatus = table.checkStatus(obj.config.id)
            switch (obj.event) {
                case 'addRow':
                    buttonArr = [];//清空数组
                    var assessmentRationalityTable2Data = table.cache.assessmentRationalityTable2Id;
                    console.log('assessmentRationalityTable2Data is',assessmentRationalityTable2Data)
                    for (var i = 0; i < assessmentRationalityTable2Data.length; i++) {
                        buttonArr.push(assessmentRationalityTable2Data[i]);      //将之前的数组存储
                    }
                    //在尾部新增一行空数据，实现增行效果
                    buttonArr.push({
                        "courseObjectives": '',
                        "testQuestions": '',
                        "score":''
                    });
                    table.reload("assessmentRationalityTable2Id", {
                        data: buttonArr   // 将新数据重新载入表格
                    })
                    layer.msg('添加成功')
                    break;
            }
        })

        table.on('tool(assessmentRationalityTable2)',function (obj) {
            var data = obj.data; //获得当前行数据
            console.log('data is',data)
            var layEvent = obj.event; //获得 lay-event 对应的值（也可以是表头的 event 参数对应的值）
            var tr = obj.tr; //获得当前行 tr 的 DOM 对象（如果有的话）

            if(layEvent === 'detail'){ //查看
                //do somehing
            } else if(layEvent === 'del'){ //删除
                layer.confirm('真的删除行么', function(index){
                    obj.del(); //删除对应行（tr）的DOM结构，并更新缓存
                    layer.close(index);
                    //向服务端发送删除指令
                });
            } else if(layEvent === 'edit'){ //编辑
                //do something
                //同步更新缓存对应的值
                obj.update({
                    data
                });
                layer.msg('保存成功')
            } else if(layEvent === 'LAYTABLE_TIPS'){
                layer.alert('Hi，头部工具栏扩展的右侧图标。');
            }
        })

        table.on('edit(assessmentRationalityTable2)', function(obj){ //注：edit是固定事件名，test是table原始容器的属性 lay-filter="对应的值"
            console.log(obj.value); //得到修改后的值
            console.log(obj.field); //当前编辑的字段名
            console.log(obj.data); //所在行的所有相关数据
            var data = obj.data
            obj.update({
                data
            })
        });



        // 考核合理性审核表格3
        table.render({
            elem: '#assessmentRationalityTable3'
            ,id:'assessmentRationalityTable3Id'
            ,toolbar:true
            ,defaultToolbar:[{
                title:'新增'
                ,layEvent:'addRow'
                ,icon:'layui-icon-addition'
            }]
            ,height: 312
            ,data:[]
            ,cols: [[ //表头
                {field: 'title', title: '标题',edit:'text'}
                ,{field: 'content', title: '内容', edit:'text'}
                ,{fixed: 'right', align:'center', toolbar: '#courseTargetRowToolbar'}
            ]]
        });

        table.on('toolbar(assessmentRationalityTable3)',function (obj) {
            var checkStatus = table.checkStatus(obj.config.id)
            switch (obj.event) {
                case 'addRow':
                    buttonArr = [];//清空数组
                    var assessmentRationalityTable3Data = table.cache.assessmentRationalityTable3Id;
                    console.log('assessmentRationalityTable3Data is',assessmentRationalityTable3Data)
                    for (var i = 0; i < assessmentRationalityTable3Data.length; i++) {
                        buttonArr.push(assessmentRationalityTable3Data[i]);      //将之前的数组存储
                    }
                    //在尾部新增一行空数据，实现增行效果
                    buttonArr.push({
                        "title": '',
                        "content": '',
                    });
                    table.reload("assessmentRationalityTable3Id", {
                        data: buttonArr   // 将新数据重新载入表格
                    })
                    layer.msg('添加成功')
                    break;
            }
        })

        table.on('tool(assessmentRationalityTable3)',function (obj) {
            var data = obj.data; //获得当前行数据
            console.log('data is',data)
            var layEvent = obj.event; //获得 lay-event 对应的值（也可以是表头的 event 参数对应的值）
            var tr = obj.tr; //获得当前行 tr 的 DOM 对象（如果有的话）

            if(layEvent === 'detail'){ //查看
                //do somehing
            } else if(layEvent === 'del'){ //删除
                layer.confirm('真的删除行么', function(index){
                    obj.del(); //删除对应行（tr）的DOM结构，并更新缓存
                    layer.close(index);
                    //向服务端发送删除指令
                });
            } else if(layEvent === 'edit'){ //编辑
                //do something
                //同步更新缓存对应的值
                obj.update({
                    data
                });
                layer.msg('保存成功')
            } else if(layEvent === 'LAYTABLE_TIPS'){
                layer.alert('Hi，头部工具栏扩展的右侧图标。');
            }
        })

        table.on('edit(assessmentRationalityTable3)', function(obj){ //注：edit是固定事件名，test是table原始容器的属性 lay-filter="对应的值"
            console.log(obj.value); //得到修改后的值
            console.log(obj.field); //当前编辑的字段名
            console.log(obj.data); //所在行的所有相关数据
            var data = obj.data
            obj.update({
                data
            })
        });

        // 平时成绩评分标准
        table.render({
            elem: '#usualScoreStandard'
            ,id:'usualScoreStandardId'
            ,toolbar:true
            ,defaultToolbar:[{
                title:'新增'
                ,layEvent:'addRow'
                ,icon:'layui-icon-addition'
            }]
            ,height: 312
            ,data:[]
            ,cols: [[ //表头
                {field: 'courseObjectives', title: '课程目标',edit:'text'}
                ,{field: 'level1', title: '90~100', edit:'text'}
                ,{field: 'level2', title: '75~89', edit:'text'}
                ,{field: 'level3', title: '60~74', edit:'text'}
                ,{field: 'level4', title: '0~59', edit:'text'}
                ,{field: 'gradePercentage', title: '成绩占比', edit:'text'}
                ,{fixed: 'right', align:'center', toolbar: '#courseTargetRowToolbar'}
            ]]
        });

        table.on('toolbar(usualScoreStandard)',function (obj) {
            var checkStatus = table.checkStatus(obj.config.id)
            switch (obj.event) {
                case 'addRow':
                    buttonArr = [];//清空数组
                    var usualScoreStandardIdData = table.cache.usualScoreStandardId;
                    console.log('usualScoreStandardIdData is',usualScoreStandardIdData)
                    for (var i = 0; i < usualScoreStandardIdData.length; i++) {
                        buttonArr.push(usualScoreStandardIdData[i]);      //将之前的数组存储
                    }
                    //在尾部新增一行空数据，实现增行效果
                    buttonArr.push({
                        "title": '',
                        "content": '',
                    });
                    table.reload("usualScoreStandardId", {
                        data: buttonArr   // 将新数据重新载入表格
                    })
                    layer.msg('添加成功')
                    break;
            }
        })

        table.on('tool(usualScoreStandard)',function (obj) {
            var data = obj.data; //获得当前行数据
            console.log('data is',data)
            var layEvent = obj.event; //获得 lay-event 对应的值（也可以是表头的 event 参数对应的值）
            var tr = obj.tr; //获得当前行 tr 的 DOM 对象（如果有的话）

            if(layEvent === 'detail'){ //查看
                //do somehing
            } else if(layEvent === 'del'){ //删除
                layer.confirm('真的删除行么', function(index){
                    obj.del(); //删除对应行（tr）的DOM结构，并更新缓存
                    layer.close(index);
                    //向服务端发送删除指令
                });
            } else if(layEvent === 'edit'){ //编辑
                //do something
                //同步更新缓存对应的值
                obj.update({
                    data
                });
                layer.msg('保存成功')
            } else if(layEvent === 'LAYTABLE_TIPS'){
                layer.alert('Hi，头部工具栏扩展的右侧图标。');
            }
        })

        table.on('edit(usualScoreStandard)', function(obj){ //注：edit是固定事件名，test是table原始容器的属性 lay-filter="对应的值"
            console.log(obj.value); //得到修改后的值
            console.log(obj.field); //当前编辑的字段名
            console.log(obj.data); //所在行的所有相关数据
            var data = obj.data
            obj.update({
                data
            })
        });

        //  评价结果表格
        table.render({
            elem: '#evaluationResults'
            ,id:'evaluationResultsId'
            ,toolbar:true
            ,defaultToolbar:[{
                title:'新增'
                ,layEvent:'addRow'
                ,icon:'layui-icon-addition'
            }]
            ,height: 312
            ,data:[]
            ,cols: [[ //表头
                {field: 'id', title: 'ID', hide:true }
                ,{field: 'groupId', title: '分组ID', hide:true }
                ,{field: 'courseObjectives', title: '课程目标',edit:'text'}
                ,{field: 'knowledgeAndAbility', title: '知识和能力', edit:'text'}
                ,{field: 'assessmentPoints', title: '考核点', edit:'text'}
                ,{field: 'assessmentContent', title: '考核内容', edit:'text'}
                ,{field: 'assessmentPointsWeight', title: '考核点权重', edit:'text'}
                ,{field: 'assessmentDegree', title: '考核点达成度', edit:'text'}
                ,{field: 'achievementDegree', title: '课程目标达成度', edit:'text'}
                ,{fixed: 'right', align:'center', toolbar: '#evaluateAbilityRelevanceRowToolbar',width:120}
            ]]
            , done : function(res, curr, count) {
                //如果是异步请求数据方式，res即为你接口返回的信息。
                //如果是直接赋值的方式，res即为：{data: [], count: 99} data为当前页数据、count为数据总长度
                console.log(res);

                //得到当前页码
                console.log(curr);

                //得到数据总量
                console.log(count);

                // 合并单元格
                evaluationResultsCardMerge(res);
            }
        });

        table.on('toolbar(evaluationResults)',function (obj) {
            var checkStatus = table.checkStatus(obj.config.id)
            switch (obj.event) {
                case 'addRow':
                    buttonArr = [];//清空数组
                    var evaluationResultsData = table.cache.evaluationResultsId;
                    console.log('evaluationResultsData is',evaluationResultsData)
                    for (var i = 0; i < evaluationResultsData.length; i++) {
                        buttonArr.push(evaluationResultsData[i]);      //将之前的数组存储
                    }
                    var currentGroupId
                    if(evaluationResultsData.length > 0){
                        currentGroupId = evaluationResultsData[evaluationResultsData.length-1].groupId + 1
                    }else {
                        currentGroupId = 1
                    }
                    //在尾部新增一行空数据，实现增行效果,id设置为最近一条数据+1
                    buttonArr.push({
                        id:getRandom(),
                        groupId:currentGroupId,
                        courseObjectives:'待填充' + currentGroupId,
                        knowledgeAndAbility:'待填充' + currentGroupId,
                        assessmentPoints:'',
                        assessmentContent:'',
                        assessmentPointsWeight:0,
                        assessmentDegree:0,
                        achievementDegree:currentGroupId,
                    });
                    table.reload("evaluationResultsId", {
                        data: buttonArr   // 将新数据重新载入表格
                    })
                    layer.msg('添加成功')
                    break;
            }
        })

        table.on('tool(evaluationResults)',function (obj) {
            var data = obj.data; //获得当前行数据
            console.log('data is',data)
            var layEvent = obj.event; //获得 lay-event 对应的值（也可以是表头的 event 参数对应的值）
            var tr = obj.tr; //获得当前行 tr 的 DOM 对象（如果有的话）

            if(layEvent === 'detail'){ //查看
                //do somehing
            } else if(layEvent === 'del'){ //删除
                layer.confirm('真的删除行么', function(index){
                    buttonArr = [];//清空数组
                    var evaluationResultsData = table.cache.evaluationResultsId;
                    for (var i = evaluationResultsData.length - 1; i >= 0 ; i--) {
                        if(evaluationResultsData[i].id === data.id){
                            evaluationResultsData.splice(i,1)
                            break
                        }
                    }
                    for (var i = 0; i < evaluationResultsData.length; i++) {
                        buttonArr.push(evaluationResultsData[i]);      //将之前的数组存储
                    }
                    table.reload("evaluationResultsId", {
                        data: buttonArr   // 将新数据重新载入表格
                    })
                    layer.close(index)
                });
            } else if(layEvent === 'edit'){ //编辑
                //do something
                //同步更新缓存对应的值
                obj.update({
                    data
                });
                layer.msg('保存成功')
            } else if(layEvent === 'LAYTABLE_TIPS'){
                layer.alert('Hi，头部工具栏扩展的右侧图标。');
            } else if(layEvent === 'add'){ // 新增
                buttonArr = [];//清空数组
                var evaluationResultsData = table.cache.evaluationResultsId;
                var index
                for (var i = evaluationResultsData.length - 1; i >= 0 ; i--) {
                    if(evaluationResultsData[i].id === data.id){
                        index = i
                        break
                    }
                }
                for (var i = 0; i < evaluationResultsData.length; i++) {
                    buttonArr.push(evaluationResultsData[i]);      //将之前的数组存储
                }
                console.log('evaluationResultsData is',evaluationResultsData)
                console.log('index is',index)
                //在该数据后部增加一条数据
                buttonArr.insert(index+1,{
                    id:getRandom(),
                    groupId:data.groupId,
                    courseObjectives:data.courseObjectives,
                    knowledgeAndAbility:data.knowledgeAndAbility,
                    assessmentPoints:'',
                    assessmentContent:'',
                    assessmentPointsWeight:0,
                    assessmentDegree:0,
                    achievementDegree:data.achievementDegree
                });
                table.reload("evaluationResultsId", {
                    data: buttonArr   // 将新数据重新载入表格
                })
                layer.msg('添加成功')
            }
        })


        table.on('edit(evaluationResults)', function(obj){ //注：edit是固定事件名，test是table原始容器的属性 lay-filter="对应的值"
            console.log(obj.value); //得到修改后的值
            console.log(obj.field); //当前编辑的字段名
            console.log(obj.data); //所在行的所有相关数据
            var data = obj.data
            buttonArr = [];//清空数组
            var evaluationResultsData = table.cache.evaluationResultsId;
            for (var i = evaluationResultsData.length - 1; i >= 0 ; i--) {
                if(evaluationResultsData[i].groupId === data.groupId){
                    evaluationResultsData[i].courseObjectives = data.courseObjectives
                    evaluationResultsData[i].knowledgeAndAbility = data.knowledgeAndAbility
                    evaluationResultsData[i].achievementDegree = data.achievementDegree
                }
            }
            for (var i = 0; i < evaluationResultsData.length; i++) {
                buttonArr.push(evaluationResultsData[i]);      //将之前的数组存储
            }
            table.reload("evaluationResultsId", {
                data: buttonArr   // 将新数据重新载入表格
            })
        });
    })

    function evaluateAbilityRelevanceCardMerge(res){
        var data = res.data;
        console.log('merge res.data is', data)
        var mergeIndex = 0;//定位需要添加合并属性的行数
        var mark = 1; //这里涉及到简单的运算，mark是计算每次需要合并的格子数
        var columsName = ['groupId','courseObjectives'];//需要合并的列名称
        var columsIndex = [1,2];//需要合并的列索引值

        for (var k = 0; k < columsName.length; k++) { //这里循环所有要合并的列
            var trArr = $("#evaluateAbilityRelevanceCard").find("tbody tr");//获取evaluateAbilityRelevanceCard下表格所有的tbody tr
            console.log('trArr is',trArr)
            for (var i = 1; i < res.data.length; i++) { //这里循环表格当前的数据
                var tdCurArr = trArr.eq(i).find("td").eq(columsIndex[k]);//获取当前行的当前列
                var tdPreArr = trArr.eq(mergeIndex).find("td").eq(columsIndex[k]);//获取相同列的第一列

                if (data[i][columsName[k]] === data[i-1][columsName[k]]) { //后一行的值与前一行的值做比较，相同就需要合并
                    mark += 1;
                    tdPreArr.each(function () {//相同列的第一列增加rowspan属性
                        $(this).attr("rowspan", mark);
                    });
                    tdCurArr.each(function () {//当前行隐藏
                        $(this).css("display", "none");
                    });
                }else {
                    mergeIndex = i;
                    mark = 1;//一旦前后两行的值不一样了，那么需要合并的格子数mark就需要重新计算
                }
            }
            mergeIndex = 0;
            mark = 1;
        }
    }

    function evaluationResultsCardMerge(res){
        var data = res.data;
        console.log('merge res.data is', data)
        var mergeIndex = 0;//定位需要添加合并属性的行数
        var mark = 1; //这里涉及到简单的运算，mark是计算每次需要合并的格子数
        var columsName = ['groupId','courseObjectives','knowledgeAndAbility','achievementDegree'];//需要合并的列名称
        var columsIndex = [1,2,3,8];//需要合并的列索引值

        for (var k = 0; k < columsName.length; k++) { //这里循环所有要合并的列
            var trArr = $("#evaluationResultsCard").find("tbody tr");//获取evaluateAbilityRelevanceCard下表格所有的tbody tr
            console.log('trArr is',trArr)
            for (var i = 1; i < res.data.length; i++) { //这里循环表格当前的数据
                var tdCurArr = trArr.eq(i).find("td").eq(columsIndex[k]);//获取当前行的当前列
                var tdPreArr = trArr.eq(mergeIndex).find("td").eq(columsIndex[k]);//获取相同列的第一列

                if (data[i][columsName[k]] === data[i-1][columsName[k]]) { //后一行的值与前一行的值做比较，相同就需要合并
                    mark += 1;
                    tdPreArr.each(function () {//相同列的第一列增加rowspan属性
                        $(this).attr("rowspan", mark);
                    });
                    tdCurArr.each(function () {//当前行隐藏
                        $(this).css("display", "none");
                    });
                }else {
                    mergeIndex = i;
                    mark = 1;//一旦前后两行的值不一样了，那么需要合并的格子数mark就需要重新计算
                }
            }
            mergeIndex = 0;
            mark = 1;
        }
    }

    function getRandom(){
        var num = '';
        for (var i = 0; i < 6; i++) {
            num += Math.floor(Math.random() * 10);
        }
        console.log(num);
        return num;
    }

    layui.use(['form', 'jquery','laydate','dictionary'], function () {
        let form = layui.form;
        let $ = layui.jquery;
        let laydate = layui.laydate;

        laydate.render({
            elem: '#audittime' //指定元素
            ,format: 'yyyy-MM-dd'
        });

        let prefix = "/system/baseinfo/"


        form.on('submit(baseinfo-save)', function (data) {
            console.log('baseinfo-save .data.field is', JSON.stringify(data.field))
            for(var key in data.field){
                var type=$(data.form).find("input[name='"+key+"']").attr("type");
                if(type=="checkbox"){
                    var value="";
                    $(data.form).find("input[name='"+key+"']:checked").each(function(){
                        value+=$(this).val()+",";
                    })
                    if(value!=""){
                        value=value.substr(0,value.length-1);
                        data.field[key]=value;
                    }

                }
            }
            var formData = data.field

            //基础数据
            var reportBaseinfo = {
                "title":formData.title,
                "academic":formData.academic,
                "typeAndScore":formData.typeAndScore,
                "classStudentNum":formData.classStudentNum,
                "teacher":formData.teacher,
                "assessmentMethod":formData.assessmentMethod,
                "evaluationBasis":formData.evaluationBasis,
                "studentQuestionnaire":studentQuestionnaire.join(';'),
                "auditOpinion":formData.auditOpinion,
                "audittime":formData.audittime
            }

            // 课程目标
            var reportCourseTargetTableData = layui.table.cache.courseTargetId

            // 课程目标与毕业要求观测点的对应关系
            var reportTargetObservationContactTableData = layui.table.cache.courseTargetobservationContactId

            // 评价内容与学生能力相关性
            var reportEvaluateAbilityRelevanceTableData = layui.table.cache.evaluateAbilityRelevanceId

            // 考核合理性审核
            var reportAssessmentRationalityTable1Data =  layui.table.cache.assessmentRationalityTable1Id
            var graduationRequirementsJson = []
            for (let i = 0; i < reportAssessmentRationalityTable1Data.length; i++) {
                var graduationRequirementsItem = {
                    "graduationRequirements": reportAssessmentRationalityTable1Data[i].graduationRequirements,
                    "indexPoint": reportAssessmentRationalityTable1Data[i].indexPoint,
                    "courseObjectives":reportAssessmentRationalityTable1Data[i].courseObjectives
                }
                graduationRequirementsJson.push(graduationRequirementsItem)
            }
            var reportAssessmentRationalityTable2Data =  layui.table.cache.assessmentRationalityTable2Id
            var scoreJson = []
            for (let i = 0; i < reportAssessmentRationalityTable2Data.length; i++) {
                var scoreItem = {
                    "courseObjectives": reportAssessmentRationalityTable2Data[i].courseObjectives,
                    "testQuestions": reportAssessmentRationalityTable2Data[i].testQuestions,
                    "score":reportAssessmentRationalityTable2Data[i].score
                }
                scoreJson.push(scoreItem)
            }

            var reportAssessmentRationalityTable3Data =  layui.table.cache.assessmentRationalityTable3Id
            var scoreContentJson = []
            for (let i = 0; i < reportAssessmentRationalityTable3Data.length; i++) {
                var scoreContentItem = {
                    "title": reportAssessmentRationalityTable3Data[i].title,
                    "content": reportAssessmentRationalityTable3Data[i].content
                }
                scoreContentJson.push(scoreContentItem)
            }
            var reportAssessmentRationalityData = {
                "semester": formData.semester,
                "course": formData.course,
                "teacherpaper": formData.teacherpaper,
                "teachercheck": formData.teachercheck,
                "grade": formData.grade,
                "graduationRequirementsJson":JSON.stringify(graduationRequirementsJson),
                "scoreJson":JSON.stringify(scoreJson),
                "scoreContentJson":JSON.stringify(scoreContentJson),
                "courseGroupAuditOpinion":formData.courseGroupAuditOpinion,
                "majorAuditOpinion":formData.majorAuditOpinion
            }

            // 平时成绩评分标准
            var reportUsualScoreStandardTableData = layui.table.cache.usualScoreStandardId
            for (let i = 0; i < reportUsualScoreStandardTableData.length; i++) {
                reportUsualScoreStandardTableData[i].gradePercentage = parseFloat(reportUsualScoreStandardTableData[i].gradePercentage.replaceAll("%"))
            }

            // 评价结果
            var reportEvaluationResultsTableData = layui.table.cache.evaluationResultsId

            // 任课教师分析与改进
            var teacherAnalysisImprovementData = {
                "imgUrl": teacherAnalysisImprovementImgUrl.join(';'),
                "explain":formData.explain,
                "causeJson":formData.cause,
                "measuresJson":formData.measures
            }

            // 构建提交数据表单
            var saveData = {
                "reportBaseinfo":reportBaseinfo,
                "reportCourseTargetList":reportCourseTargetTableData,
                "reportTargetObservationContactList": reportTargetObservationContactTableData,
                "reportEvaluateAbilityRelevanceList": reportEvaluateAbilityRelevanceTableData,
                "reportAssessmentRationality":reportAssessmentRationalityData,
                "reportUsualScoreStandardList":reportUsualScoreStandardTableData,
                "reportEvaluationResultsList":reportEvaluationResultsTableData,
                "teacherAnalysisImprovement":teacherAnalysisImprovementData
            }


            console.log('saveData is', saveData)



            $.ajax({
                url: prefix+'save',
                data: JSON.stringify(saveData),
                dataType: 'json',
                contentType: 'application/json',
                type: 'post',
                success: function (result) {
                    if (result.success) {
                        layer.msg(result.msg, {icon: 1, time: 1000}, function () {
                            parent.layer.close(parent.layer.getFrameIndex(window.name));
                            parent.layui.table.reload("baseinfo-table");
                        });
                    } else {
                        layer.msg(result.msg, {icon: 2, time: 1000});
                    }
                }
            })
            return false;
        });
    });
    layui.use('upload', function(){
        var upload = layui.upload;

        //执行实例
        var uploadInst = upload.render({
            elem: '#teacherAnalysisImprovementUpload' //绑定元素
            ,url: '/system/file/upload/' //上传接口
            ,multiple:true
            ,before: function(obj){
                //预读本地文件示例，不支持ie8
                obj.preview(function(index, file, result){
                    $('#teacherAnalysisImprovementUploadUrl').append('<img src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img">')
                });
            }
            ,done: function(res){
                //上传完毕回调
                console.log('res is', res)
                if(res.code === 0){
                    teacherAnalysisImprovementImgUrl.push(res.data)
                    layer.msg('上传成功')
                }
            }
            ,error: function(){
               //请求异常回调
                layer.msg('图片上传失败')
            }
    });
        //执行实例
        var uploadInst = upload.render({
            elem: '#studentQuestionnaireUpload' //绑定元素
            ,url: '/system/file/upload/' //上传接口
            ,multiple:true
            ,before: function(obj){
                //预读本地文件示例，不支持ie8
                obj.preview(function(index, file, result){
                    $('#studentQuestionnaireUploadUrl').append('<img src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img">')
                });
            }
            ,done: function(res){
                //上传完毕回调
                console.log('res is', res)
                if(res.code === 0){
                    layer.msg('上传成功')
                    studentQuestionnaire.push(res.data)
                }
            }
            ,error: function(){
               //请求异常回调
                layer.msg('图片上传失败')
            }
    });
});


</script>
</html>
